package com.itcast.springboot.waste_recovery.controller;


import com.itcast.springboot.waste_recovery.common.CommonResult;
import com.itcast.springboot.waste_recovery.common.CommonResultCode;
import com.itcast.springboot.waste_recovery.domain.UserHelp;
import com.itcast.springboot.waste_recovery.service.UserHelpService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用户帮助中心 前端控制器
 * </p>
 *
 * @author 小破烂
 * @since 2020-08-19
 */
@RestController
@RequestMapping("/waste_recovery/user-help")
@Slf4j
@Api(tags = "用户帮助中心类接口")
public class UserHelpController {

    @Resource(name = "userHelpServiceImpl")
    UserHelpService userHelpService;

    @GetMapping("/customer/all")
    @ApiOperation(value = "帮助中心")
    @RequiresPermissions("user-operated")       //拥有 user-operated 才可以访问
    public CommonResult getUserHelps(){
        List<UserHelp> userHelps = userHelpService.getUserHelps();
        return new CommonResult(CommonResultCode.CommonSuccess, userHelps);
    }
}

